// 形成组件名和具体组件的一个映射关系，用于还原组件

import SingleSelect from '@/components/Survey/Materials/SelectComs/SingleSelect.vue';
import MultiSelect from '@/components/Survey/Materials/SelectComs/MultiSelect.vue';
import OptionSelect from '@/components/Survey/Materials/SelectComs/OptionSelect.vue';
import SinglePicSelect from '@/components/Survey/Materials/SelectComs/SinglePicSelect.vue';
import MultiPicSelect from '@/components/Survey/Materials/SelectComs/MultiPicSelect.vue';
import TextNote from '@/components/Survey/Materials/NoteComs/TextNote.vue';
import TextInput from '@/components/Survey/Materials/InputComs/TextInput.vue';
import DateTime from '@/components/Survey/Materials/AdvancedComs/DateTime.vue';
import RateScore from '@/components/Survey/Materials/AdvancedComs/RateScore.vue';

import ColorEditor from '@/components/Editor/ColorEditor.vue';
import DateTimeTypeEditor from '@/components/Editor/DateTimeTypeEditor.vue';
import DescEditor from '@/components/Editor/DescEditor.vue';
import ItalicEditor from '@/components/Editor/ItalicEditor.vue';
import MaxLengthEditor from '@/components/Editor/MaxLengthEditor.vue';
import OptionsEditor from '@/components/Editor/OptionsEditor.vue';
import PicOptionsEditor from '@/components/Editor/PicOptionsEditor.vue';
import PositionEditor from '@/components/Editor/PositionEditor.vue';
import RateTextEditor from '@/components/Editor/RateTextEditor.vue';
import SizeEditor from '@/components/Editor/SizeEditor.vue';
import TextInputTypeEditor from '@/components/Editor/TextInputTypeEditor.vue';
import TextTypeEditor from '@/components/Editor/TextTypeEditor.vue';
import TitleEditor from '@/components/Editor/TitleEditor.vue';
import WeightEditor from '@/components/Editor/WeightEditor.vue';

import { markRaw } from 'vue';
import type { VueComType } from '@/types';

type ComponentMap = {
  [key: string]: VueComType;
};

export const componentMap: ComponentMap = {
  // 业务组件
  'single-select': markRaw(SingleSelect),
  'multi-select': markRaw(MultiSelect),
  'option-select': markRaw(OptionSelect),
  'single-pic-select': markRaw(SinglePicSelect),
  'multi-pic-select': markRaw(MultiPicSelect),
  'text-note': markRaw(TextNote),
  'text-input': markRaw(TextInput),
  'personal-info-name': markRaw(TextInput),
  'personal-info-id': markRaw(TextInput),
  'personal-info-tel': markRaw(TextInput),
  'personal-info-wechat': markRaw(TextInput),
  'personal-info-qq': markRaw(TextInput),
  'personal-info-email': markRaw(TextInput),
  'personal-info-address': markRaw(TextInput),
  'personal-info-gender': markRaw(SingleSelect),
  'personal-info-age': markRaw(SingleSelect),
  'personal-info-education': markRaw(SingleSelect),
  'personal-info-career': markRaw(SingleSelect),
  'date-time': markRaw(DateTime),
  'personal-info-birth': markRaw(DateTime),
  'personal-info-collage': markRaw(TextInput),
  'personal-info-major': markRaw(TextInput),
  'personal-info-industry': markRaw(TextInput),
  'personal-info-company': markRaw(TextInput),
  'personal-info-position': markRaw(TextInput),
  'rate-score': markRaw(RateScore),
  // 编辑组件
  'title-editor': markRaw(TitleEditor),
  'desc-editor': markRaw(DescEditor),
  'position-editor': markRaw(PositionEditor),
  'options-editor': markRaw(OptionsEditor),
  'size-editor': markRaw(SizeEditor),
  'weight-editor': markRaw(WeightEditor),
  'italic-editor': markRaw(ItalicEditor),
  'text-input-type-editor': markRaw(TextInputTypeEditor),
  'text-type-editor': markRaw(TextTypeEditor),
  'pic-options-editor': markRaw(PicOptionsEditor),
  'date-time-type-editor': markRaw(DateTimeTypeEditor),
  'rate-text-editor': markRaw(RateTextEditor),
  'color-editor': markRaw(ColorEditor),
  'max-length-editor': markRaw(MaxLengthEditor),
};
